<template>
    <div>
        <h3>{{ name }}的歌曲列表</h3>
    </div>
</template>

<script>
export default {
    name: "MusicDetail",
    mounted() {
        /*
        我们想要获取动态路由params传值,需要使用$route
        $route.params是一个对象,包含params传递过来的数据
    */
        console.log(this.$route);
    },
    computed: {
        name() {
            const { id } = this.$route.params;
            switch (id) {
                case "1":
                    return "周杰伦";
                case "2":
                    return "林俊杰";
                case "3":
                    return "陈奕迅";
                default:
                    return "XXXX";
            }
        },
    },
};
</script>

<style></style>
